package cn.le.enums;

public enum EnumHomeStatus {

    Doing("正在拍卖"),
    Todo("即将开始"),
    ClinchADeal("成交"),
    Repent("悔拍"),
    Retreat("撤拍"),
    Hold("暂缓"),
    Cancel("拍卖/变卖取消"),
    FlowMark("流标")
    ;
    private String text;

    public String getText(){
        return this.text;
    }

    EnumHomeStatus(String text){
        this.text = text;
    }


    public static class GPWStatus{
        public static EnumHomeStatus getByCode(String text) {
            switch (text){
                case "成交":
                    return EnumHomeStatus.ClinchADeal;
                case "即将开始":
                    return EnumHomeStatus.Todo;
                case "正在拍卖":
                    return EnumHomeStatus.Doing;
                case "悔拍":
                    return EnumHomeStatus.Repent;
                case "撤拍":
                    return EnumHomeStatus.Retreat;
                case "缓拍":
                    return EnumHomeStatus.Hold;
                case "拍卖/变卖取消":
                    return EnumHomeStatus.Cancel;
                case "流标":
                    return EnumHomeStatus.FlowMark;
                case "正在进行":
                    return EnumHomeStatus.Doing;
                case "暂缓":
                    return EnumHomeStatus.Hold;
                case "中止":
                    return EnumHomeStatus.Retreat;
            }
            return null;
        }
    }

    public static class ZgzcqswStatus{
        public static EnumHomeStatus getByCode(String text) {
            switch (text){
                case "正在进行":
                    return EnumHomeStatus.Doing;
                case "即将开始":
                    return EnumHomeStatus.Todo;
                case "撤回":
                    return EnumHomeStatus.Retreat;
                case "拍卖成功":
                    return EnumHomeStatus.ClinchADeal;
                case "暂缓":
                    return EnumHomeStatus.Hold;
                case "拍卖/变卖取消":
                    return EnumHomeStatus.Cancel;
            }
            return null;
        }
    }

    public static class JdStatus {
        public static EnumHomeStatus getByCode(int auctionStatus,int displayStatus) {
            //预告中
            if (auctionStatus == 1 && displayStatus == 1){
                return EnumHomeStatus.Doing;
            }
            //拍卖中
            else if (auctionStatus == 0 && displayStatus == 1){
                return EnumHomeStatus.Todo;
            }
            //已经结束
            else if (auctionStatus == 2 && displayStatus == 1){
                return EnumHomeStatus.ClinchADeal;
            }
            //流拍
            else if (auctionStatus == 2 && displayStatus == 1){
                return EnumHomeStatus.ClinchADeal;
            }
            //暂缓
            else if (auctionStatus == 2 && displayStatus == 6){
                return EnumHomeStatus.Hold;
            }
            else if (auctionStatus == 0 && displayStatus == 6){
                return EnumHomeStatus.Hold;
            }
            //流拍
            else if (auctionStatus == 2 && displayStatus == 3){
                return EnumHomeStatus.FlowMark;
            }
            //终止
            else if (auctionStatus == 2 && displayStatus == 7){
                return EnumHomeStatus.Retreat;
            }
            //撤回
            else if (auctionStatus == 2 && displayStatus == 5){
                return EnumHomeStatus.Retreat;
            }
            return null;
        }
    }

    public static class AliStatus {
        public static EnumHomeStatus getByCode(String code) {
            switch (code) {
                case "doing":
                    return EnumHomeStatus.Doing;
                case "todo":
                    return EnumHomeStatus.Todo;
                case "done":
                    return EnumHomeStatus.ClinchADeal;
                case "revocation":
                    return EnumHomeStatus.Cancel;
                case "break":
                    return EnumHomeStatus.Retreat;
                case "failure":
                    return EnumHomeStatus.FlowMark;
            }
            return null;
        }
    }

    public static class ZpptStatus{
        //1正在进行 0即将开始 3已成交 5撤回 2流拍
        public static EnumHomeStatus getByCode(Integer code) {
            switch (code){
                case 1:
                    return EnumHomeStatus.Doing;
                case 0:
                    return EnumHomeStatus.Todo;
                case 3:
                    return EnumHomeStatus.ClinchADeal;
                case 5:
                    return EnumHomeStatus.Retreat;
                case 2:
                    return EnumHomeStatus.FlowMark;
            }
            return null;
        }
    }
}
